//217 - 存在重复元素
class Solution {
    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        int n = nums.length;
        for (int i = 0; i < n - 1; i++) {
            if (nums[i] == nums[i + 1]) {
                return true;
            }
        }
        return false;
    }
}
//409 - 最长回文串

class Solution {
    public static int longestPalindrome(String s) {
       int[] count = new int[128];
       int sum = 0;
       int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            count[c]++;
        }
        for (int i = 0; i < 128; i++) {
            if(count[i]%2 == 1){
                ans = 1;
            }
            sum += count[i]/2 * 2;
        }
        return sum + ans;
    }

    public static void main(String[] args) {
        System.out.println(Solution.longestPalindrome("abccccdd"));

    }
}
public class Test {
}
